/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Server;

import Server.ImplementInterface.CustomerObject;
import Server.ImplementInterface.DailyReportDetailObject;
import Server.ImplementInterface.DailyReportObject;
import Server.ImplementInterface.DepositObject;
import Server.ImplementInterface.MonthlyReportDetailObject;
import Server.ImplementInterface.MonthlyReportObject;
import Server.ImplementInterface.ParameterObject;
import Server.ImplementInterface.SavingBookObject;
import Server.ImplementInterface.SavingTypeObject;
import Server.ImplementInterface.WithDrawObject;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 *
 * @author 10520_000
 */
public class Server {
    public static void main(String[] args) {
        try {
            //Create and get reference to rmi registry
            Registry registry = LocateRegistry.createRegistry(1099);

            //Instantiate server object
            CustomerObject obj_customer = new CustomerObject();
            DailyReportDetailObject obj_DaiDetail = new DailyReportDetailObject();
            DailyReportObject obj_Dai = new DailyReportObject();
            DepositObject obj_Depo = new DepositObject();
            MonthlyReportDetailObject obj_MonthlyDetail = new MonthlyReportDetailObject();
            MonthlyReportObject obj_Monthly = new MonthlyReportObject();
            ParameterObject obj_Param = new ParameterObject();
            SavingBookObject obj_SavingBook = new SavingBookObject();
            SavingTypeObject obj_SavingType = new SavingTypeObject();
            WithDrawObject obj_WD = new WithDrawObject();
            
            //Register server object
            registry.rebind("Customer", obj_customer);
            registry.rebind("DailyReportDetail", obj_DaiDetail);
            registry.rebind("DailyReport", obj_Dai);
            registry.rebind("Deposit", obj_Depo);
            registry.rebind("MonthlyReportDetail", obj_MonthlyDetail);
            registry.rebind("MonthlyReport", obj_Monthly);
            registry.rebind("Parameter", obj_Param);
            registry.rebind("SavingBook", obj_SavingBook);
            registry.rebind("SavingType", obj_SavingType);
            registry.rebind("WithDraw", obj_WD);
            
            System.out.println("Server is created!!!");
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}
